<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%"
      row-key="id"
      border
      lazy
      :load="load"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
      <el-table-column
        prop="name"
        label="名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="dictCode"
        label="编码"
        width="180">
      </el-table-column>
      <el-table-column
        prop="value"
        label="value值">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建时间">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import cmn from '@/api/cmn'

export default {
  data() {
    return {
      tableData: []
    }
  },
  methods: {
    load(tree, treeNode, resolve) {
      // console.log(tree, treeNode, resolve)
      console.log("tree.value"+tree.value)
      cmn.chiefAll(tree.value).then(response => {
        console.log(response)
        resolve(response.data)
      }).catch(error => {
        console.log(error)
      })

    }
  },
  created() {
    cmn.chiefAll(1).then(response => {
      console.log("初始数据",response.data)
      this.tableData = response.data
    }).catch(error => {
      console.log(error)
    })
  }
}
</script>

<style scoped>

</style>
